<% layout('/layouts/default.html', {title: '额度设置', libs: ['validate','fileupload']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-trophy"></i> ${text('额度设置')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${clinicSetting}" action="${ctx}/fl/clinicsetting/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<#form:hidden path="id"/>

				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								${text('诊所')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								${clinicSetting.clinic.name}
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								${text('科室')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								${@DictUtils.getDictLabel('fl_department',clinicSetting.department,'未知')}
							</div>
						</div>
					</div>
					
				</div>
				<!--
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('上午开始时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:select path="amStartTime" dictType="fl_am_time" class="form-control required"/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('上午结束时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:select path="amEndTime" dictType="fl_am_time" class="form-control required"/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('下午开始时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:select path="pmStartTime" dictType="fl_pm_time" class="form-control required"/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('下午结束时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:select path="pmEndTime" dictType="fl_pm_time" class="form-control required"/>
							</div>
						</div>
					</div>
					
				</div>
				-->
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								 <span class="required ">*</span>${text('可预约时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<div class="input-group ">
									<!--#form:checkbox path="businessHours" dictType="fl_week" class="form-control required"/-->
								<input name="businessHours" id="businessHours" type="hidden">
								<input name="businessHoursLabel" class="form-control required" readonly="readonly" id="businessHoursLabel" type="textarea" rows="4">
								<span class="input-group-btn"><a class="btn btn-default " id="testUserButton" href="javascript:"><i class="fa fa-wrench"></i></a></span>
								</div>
									<script>
									$("#businessHoursLabel,#testUserButton").click(function(){
										var options = {
											type: 0,
											maxmin: true,
											shadeClose: true,
											title: '营业时间设置',
											area: ['640px', '400px'],
											content: $("#tpl-businessHours-edit").html(),
											success: function(layero, index){
												var businessHoursString = $("#businessHours").val();
												var businessHours;
												if(businessHoursString != null &&  businessHoursString.length>0){
													try{
														businessHours = JSON.parse(businessHoursString);
													}catch(e){
														businessHours = [];
													}
												}
												var days = '${clinicSetting.clinic.businessHours}';
												for(var i=1;i<8;i++){
													if(days.indexOf(i)>=0){													
														layero.context.getElementById("day"+i).style.display="block";
													}
												}
												if(businessHours!=null && businessHours.length>0){													
													$.each(businessHours, function (idx, item) {
														layero.context.getElementById("week" +item.name ).checked=true;
														layero.context.getElementById("amStart" +item.name ).value=item.amStart;
														layero.context.getElementById("amEnd" +item.name ).value=item.amEnd;
														layero.context.getElementById("pmStart" +item.name ).value=item.pmStart;
														layero.context.getElementById("pmEnd" +item.name ).value=item.pmEnd;
														
													});
												}

											},
											btn: ['<i class="fa fa-check"></i> 确定'],
											btn1: function(index, layero){	
												var businessHours = new Array();
												var week1 = layero.context.getElementById("week1").checked;
												var week2 = layero.context.getElementById("week2").checked;
												var week3 = layero.context.getElementById("week3").checked;
												var week4 = layero.context.getElementById("week4").checked;
												var week5 = layero.context.getElementById("week5").checked;
												var week6 = layero.context.getElementById("week6").checked;
												var week7 = layero.context.getElementById("week7").checked;
												var i = 0;
												if(week1){
													var amStart1 = layero.context.getElementById("amStart1").value;
													var amEnd1 = layero.context.getElementById("amEnd1").value;
													var pmStart1 = layero.context.getElementById("pmStart1").value;
													var pmEnd1 = layero.context.getElementById("pmEnd1").value;
													if(parseFloat(amEnd1) <= parseFloat(amStart1)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("amEnd1").focus();
														return false;
													}
													if(parseFloat(pmEnd1) <= parseFloat(pmStart1)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("pmEnd1").focus();
														return false;
													}
													var week1 = new Object();
													week1.name="1";
													week1.amStart=amStart1;
													week1.amEnd=amEnd1;
													week1.pmStart=pmStart1;
													week1.pmEnd=pmEnd1;
													businessHours[i++]=week1;
												}
												if(week2){
													var amStart2 = layero.context.getElementById("amStart2").value;
													var amEnd2 = layero.context.getElementById("amEnd2").value;
													var pmStart2 = layero.context.getElementById("pmStart2").value;
													var pmEnd2 = layero.context.getElementById("pmEnd2").value;
													if(parseFloat(amEnd2) <= parseFloat(amStart2)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("amEnd2").focus();
														return false;
													}
													if(parseFloat(pmEnd2) <= parseFloat(pmStart2)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("pmEnd2").focus();
														return false;
													}
													var week2 = new Object();
													week2.name="2";
													week2.amStart=amStart2;
													week2.amEnd=amEnd2;
													week2.pmStart=pmStart2;
													week2.pmEnd=pmEnd2;
													businessHours[i++]=week2;
												}
												if(week3){
													var amStart3 = layero.context.getElementById("amStart3").value;
													var amEnd3 = layero.context.getElementById("amEnd3").value;
													var pmStart3 = layero.context.getElementById("pmStart3").value;
													var pmEnd3 = layero.context.getElementById("pmEnd3").value;
													if(parseFloat(amEnd3) <= parseFloat(amStart3)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("amEnd3").focus();
														return false;
													}
													if(parseFloat(pmEnd3) <= parseFloat(pmStart3)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("pmEnd3").focus();
														return false;
													}
													var week3 = new Object();
													week3.name="3";
													week3.amStart=amStart3;
													week3.amEnd=amEnd3;
													week3.pmStart=pmStart3;
													week3.pmEnd=pmEnd3;
													businessHours[i++]=week3;
												}
												if(week4){
													var amStart4 = layero.context.getElementById("amStart4").value;
													var amEnd4 = layero.context.getElementById("amEnd4").value;
													var pmStart4 = layero.context.getElementById("pmStart4").value;
													var pmEnd4 = layero.context.getElementById("pmEnd4").value;
													if(parseFloat(amEnd4) <= parseFloat(amStart4)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("amEnd4").focus();
														return false;
													}
													if(parseFloat(pmEnd4) <= parseFloat(pmStart4)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("pmEnd4").focus();
														return false;
													}
													var week4 = new Object();
													week4.name="4";
													week4.amStart=amStart4;
													week4.amEnd=amEnd4;
													week4.pmStart=pmStart4;
													week4.pmEnd=pmEnd4;
													businessHours[i++]=week4;
												}
												if(week5){
													var amStart5 = layero.context.getElementById("amStart5").value;
													var amEnd5 = layero.context.getElementById("amEnd5").value;
													var pmStart5 = layero.context.getElementById("pmStart5").value;
													var pmEnd5 = layero.context.getElementById("pmEnd5").value;
													if(parseFloat(amEnd5) <= parseFloat(amStart5)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("amEnd5").focus();
														return false;
													}
													if(parseFloat(pmEnd5) <= parseFloat(pmStart5)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("pmEnd5").focus();
														return false;
													}
													var week5 = new Object();
													week5.name="5";
													week5.amStart=amStart5;
													week5.amEnd=amEnd5;
													week5.pmStart=pmStart5;
													week5.pmEnd=pmEnd5;
													businessHours[i++]=week5;
												}
												if(week6){
													var amStart6 = layero.context.getElementById("amStart6").value;
													var amEnd6 = layero.context.getElementById("amEnd6").value;
													var pmStart6 = layero.context.getElementById("pmStart6").value;
													var pmEnd6 = layero.context.getElementById("pmEnd6").value;
													if(parseFloat(amEnd6) <= parseFloat(amStart6)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("amEnd6").focus();
														return false;
													}
													if(parseFloat(pmEnd6) <= parseFloat(pmStart6)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("pmEnd6").focus();
														return false;
													}
													var week6 = new Object();
													week6.name="6";
													week6.amStart=amStart6;
													week6.amEnd=amEnd6;
													week6.pmStart=pmStart6;
													week6.pmEnd=pmEnd6;
													businessHours[i++]=week6;
												}
												if(week7){
													var amStart7 = layero.context.getElementById("amStart7").value;
													var amEnd7 = layero.context.getElementById("amEnd7").value;
													var pmStart7 = layero.context.getElementById("pmStart7").value;
													var pmEnd7 = layero.context.getElementById("pmEnd7").value;
													if(parseFloat(amEnd7) <= parseFloat(amStart7)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("amEnd7").focus();
														return false;
													}
													if(parseFloat(pmEnd7) <= parseFloat(pmStart7)){
														alert("结束时间必须晚于开始时间！");
														layero.context.getElementById("pmEnd7").focus();
														return false;
													}
													var week7 = new Object();
													week7.name="7";
													week7.amStart=amStart7;
													week7.amEnd=amEnd7;
													week7.pmStart=pmStart7;
													week7.pmEnd=pmEnd7;
													businessHours[i++]=week7;
												}
												if(i==0){
													alert("不能一天都不选。请选择要设置的时间段");
													return false;
												}
												$("#businessHours").val(JSON.stringify(businessHours)).change();
												$("#businessHoursLabel").val(toLabel($("#businessHours").val())).change();
											}
										};
										options.btn.push('<i class="fa fa-close"></i> 关闭');
										js.layer.open(options);
									});
									</script>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('服务时间片')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:select path="serviceTime" dictType="fl_service_time" class="form-control required"/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('单位时间片服务人数')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:input path="number" maxlength="3" class="form-control required digits"/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('科室介绍')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:textarea path="departmentDescription" rows="4" maxlength="2000" class="form-control required "/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('英文科室介绍')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:textarea path="enDepartmentDescription" rows="4" maxlength="2000" class="form-control required "/>
							</div>
						</div>
					</div>
					
				</div>
				
				

			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-9">
						<% if (hasPermi('fl:clinicsetting:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>

<script type="text/template" id="tpl-businessHours-edit">
            <div class="col-sm-12 m-b-20" style="position:relative;">
                    <div id="day1" class="row form-inline" style="display:none">
                    		<input type="checkbox" name="week1" id="week1" value="1">
                        <label class="control-label">星期一:</label>
                        <label class="control-label">上午开始:</label>
                        <select name="amStart1" id="amStart1" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束:</label>
                        <select name="amEnd1" id="amEnd1" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12" selected="true">12</Option>
                        </select>
                        <label class="control-label">下午开始:</label>
                        <select name="pmStart1" id="pmStart1" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="12" selected="true">12</Option>
                        	<option value="12.5">12:30</Option>
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                        
                        <label class="control-label">结束:</label>
                        <select name="pmEnd1" id="pmEnd1" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                    </div>
                     <div id="day2" class="row form-inline" style="display:none">
                    		<input type="checkbox" name="week2" id="week2" value="2">
                    		<label class="control-label">星期二:</label>
                        <label class="control-label">上午开始:</label>
                        <select name="amStart2" id="amStart2" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束:</label>
                        <select name="amEnd2" id="amEnd2" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12" selected="true">12</Option>
                        </select>
                        <label class="control-label">下午开始:</label>
                        <select name="pmStart2" id="pmStart2" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="12" selected="true">12</Option>
                        	<option value="12.5">12:30</Option>
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                        
                        <label class="control-label">结束:</label>
                        <select name="pmEnd2" id="pmEnd2" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                    </div>
                    <div id="day3" class="row form-inline" style="display:none">
                    		<input type="checkbox" name="week3" id="week3" value="3">
                    		<label class="control-label">星期三:</label>
                        <label class="control-label">上午开始:</label>
                        <select name="amStart3" id="amStart3" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束:</label>
                        <select name="amEnd3" id="amEnd3" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12" selected="true">12</Option>
                        </select>
                        <label class="control-label">下午开始:</label>
                        <select name="pmStart3" id="pmStart3" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="12" selected="true">12</Option>
                        	<option value="12.5">12:30</Option>
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                        
                        <label class="control-label">结束:</label>
                        <select name="pmEnd3" id="pmEnd3" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                    </div>
                    <div id="day4" class="row form-inline" style="display:none">
                    		<input type="checkbox" name="week4" id="week4" value="4">
                    		<label class="control-label">星期四:</label>
                        <label class="control-label">上午开始:</label>
                        <select name="amStart4" id="amStart4" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束:</label>
                        <select name="amEnd4" id="amEnd4" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12" selected="true">12</Option>
                        </select>
                        <label class="control-label">下午开始:</label>
                        <select name="pmStart4" id="pmStart4" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="12" selected="true">12</Option>
                        	<option value="12.5">12:30</Option>
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                        
                        <label class="control-label">结束:</label>
                        <select name="pmEnd4" id="pmEnd4" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                    </div>
                    <div id="day5" class="row form-inline" style="display:none">
                    		<input type="checkbox" name="week5" id="week5" value="5">
                    		<label class="control-label">星期五:</label>
                        <label class="control-label">上午开始:</label>
                        <select name="amStart5" id="amStart5" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束:</label>
                        <select name="amEnd5" id="amEnd5" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12" selected="true">12</Option>
                        </select>
                        <label class="control-label">下午开始:</label>
                        <select name="pmStart5" id="pmStart5" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="12" selected="true">12</Option>
                        	<option value="12.5">12:30</Option>
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                        
                        <label class="control-label">结束:</label>
                        <select name="pmEnd5" id="pmEnd5" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                    </div>
                    <div id="day6" class="row form-inline" style="display:none">
                    		<input type="checkbox" name="week6" id="week6" value="6">
                    		<label class="control-label">星期六:</label>
                        <label class="control-label">上午开始:</label>
                        <select name="amStart6" id="amStart6" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束:</label>
                        <select name="amEnd6" id="amEnd6" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12" selected="true">12</Option>
                        </select>
                        <label class="control-label">下午开始:</label>
                        <select name="pmStart6" id="pmStart6" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="12" selected="true">12</Option>
                        	<option value="12.5">12:30</Option>
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                        
                        <label class="control-label">结束:</label>
                        <select name="pmEnd6" id="pmEnd6" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                    </div>
                   <div id="day7" class="row form-inline" style="display:none">
                    		<input type="checkbox" name="week7" id="week7" value="7">
                    		<label class="control-label">星期日:</label>
                        <label class="control-label">上午开始:</label>
                        <select name="amStart7" id="amStart7" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束:</label>
                        <select name="amEnd7" id="amEnd7" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1.5">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2.5">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3.5">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4.5">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5.5">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6.5">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7.5">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8.5">8:30</Option>
                        	<option value="9">9</Option>
                        	<option value="9.5">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10.5">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11.5">11:30</Option>
                        	<option value="12" selected="true">12</Option>
                        </select>
                        <label class="control-label">下午开始:</label>
                        <select name="pmStart7" id="pmStart7" class="form-control">
                        	<option value="-1">无</Option>
                        	<option value="12" selected="true">12</Option>
                        	<option value="12.5">12:30</Option>
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                        
                        <label class="control-label">结束:</label>
                        <select name="pmEnd7" id="pmEnd7" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13.5">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14.5">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15.5">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16.5">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17.5">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18.5">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19.5">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20.5">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21.5">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22.5">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23.5">23:30</Option>
                        </select>
                    </div>
                </div>
</script>

<script>
var businessHours = '${clinicSetting.businessHours==null?[]:clinicSetting.businessHours}';
$("#businessHours").val(businessHours);
$("#businessHoursLabel").val(toLabel($("#businessHours").val())).change();
function toLabel(businessHoursString){
	var businessHoursLabel = "";
	var businessHours;
	if(businessHoursString != null &&  businessHoursString.length>0){
		try{
			businessHours = JSON.parse(businessHoursString);
		}catch(e){
			businessHours = [];
		}
	}
	if(businessHours!=null && businessHours.length>0){													
		$.each(businessHours, function (idx, item) {
			if(item.amStart == -1 && item.pmStart == -1){
				
			}else if(item.amStart == -1){
				businessHoursLabel += "星期" + getWeekName(item.name)+":"+item.pmStart+"-" + item.pmEnd+";";
			}else if(item.pmStart == -1){
				businessHoursLabel += "星期" + getWeekName(item.name)+":"+item.amStart+"-" + item.amEnd+";";
			}else{
				businessHoursLabel += "星期" + getWeekName(item.name)+":"+item.amStart+"-" + item.amEnd +","+item.pmStart+"-" + item.pmEnd+";";
			}
						
		});
	}
	return businessHoursLabel;
}

function getWeekName(name){
	if(name == "1"){
		return "一";
	}else if(name == "2"){
		return "二";
	}else if(name == "3"){
		return "三";
	}else if(name == "4"){
		return "四";
	}else if(name == "5"){
		return "五";
	}else if(name == "6"){
		return "六";
	}else{
		return "日";
	}
}



$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
</script>
